home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3s / fseek.z / fseek
Encoding:
Text File  |  1998-10-20  |  6.3 KB  |  133 lines

  1.  
  2.  
  3.  
  4. FFFFSSSSEEEEEEEEKKKK((((3333SSSS))))                                                            FFFFSSSSEEEEEEEEKKKK((((3333SSSS))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      fseek, fseek64, rewind, ftell, ftell64 - reposition a file pointer in a
  10.      stream
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
  14.  
  15.      iiiinnnntttt ffffsssseeeeeeeekkkk ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm,,,, lllloooonnnngggg ooooffffffffsssseeeetttt,,,, iiiinnnntttt wwwwhhhheeeennnncccceeee))));;;;
  16.  
  17.      iiiinnnntttt ffffsssseeeeeeeekkkk66664444 ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm,,,, lllloooonnnngggg lllloooonnnngggg ooooffffffffsssseeeetttt,,,, iiiinnnntttt wwwwhhhheeeennnncccceeee))));;;;
  18.  
  19.      vvvvooooiiiidddd rrrreeeewwwwiiiinnnndddd ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm))));;;;
  20.  
  21.      lllloooonnnngggg fffftttteeeellllllll ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm))));;;;
  22.  
  23.      lllloooonnnngggg lllloooonnnngggg fffftttteeeellllllll66664444 ((((FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm))));;;;
  24.  
  25. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  26.      _f_s_e_e_k sets the file position indicator for the stream pointed to by
  27.      _s_t_r_e_a_m.  The new position, measured in bytes from the beginning of the
  28.      file, is obtained by adding _o_f_f_s_e_t to the position specified by _w_h_e_n_c_e.
  29.  
  30.      _S_E_E_K__S_E_T    specified starting point is the beginning of the file plus
  31.                  _o_f_f_s_e_t.
  32.  
  33.      _S_E_E_K__C_U_R    starting point is the current value of the file position
  34.                  indicator plus _o_f_f_s_e_t.
  35.  
  36.      _S_E_E_K__E_N_D    specified starting point is the _E_O_F of the file plus _o_f_f_s_e_t.
  37.  
  38.      A successful call to _f_s_e_e_k clears the end-of-file indicator for the
  39.      stream.
  40.  
  41.      _f_s_e_e_k allows the file position indicator to be set beyond the end of the
  42.      existing data in the file.  If data is later written at this point,
  43.      subsequent reads of data in the gap will return zero until data is
  44.      actually written into the gap.  _f_s_e_e_k, by itself, does not extend the
  45.      size of the file.
  46.  
  47.      _r_e_w_i_n_d(_s_t_r_e_a_m) is equivalent to:
  48.  
  49.           (_v_o_i_d) _f_s_e_e_k ( _s_t_r_e_a_m , _0_L, _S_E_E_K__S_E_T),
  50.  
  51.      except that the error indicator for the stream is also cleared.  Also,
  52.      _r_e_w_i_n_d returns no value.
  53.  
  54.      _f_s_e_e_k and _r_e_w_i_n_d undo any effects of _u_n_g_e_t_c(3S) on the indicated _s_t_r_e_a_m.
  55.      After _f_s_e_e_k or _r_e_w_i_n_d, the next operation on a file opened for update may
  56.      be either input or output.
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. FFFFSSSSEEEEEEEEKKKK((((3333SSSS))))                                                            FFFFSSSSEEEEEEEEKKKK((((3333SSSS))))
  71.  
  72.  
  73.  
  74.      If _s_t_r_e_a_m is writable and buffered data has not been written to the
  75.      underlying file, _f_s_e_e_k and _r_e_w_i_n_d cause the unwritten data to be written
  76.      to the file.
  77.  
  78.      _f_t_e_l_l returns the offset of the current byte relative to the beginning of
  79.      the file associated with the named _s_t_r_e_a_m.
  80.  
  81.      The functions _f_s_e_e_k_6_4 and _f_t_e_l_l_6_4 are identical to _f_s_e_e_k and _f_t_e_l_l
  82.      respectively, except that _f_s_e_e_k_6_4 takes a _l_o_n_g _l_o_n_g as an argument and
  83.      _f_t_e_l_l_6_4 returns a _l_o_n_g _l_o_n_g.  This allows the routines to set and return
  84.      the file position indicator for files larger than 2 Gigabytes.
  85.  
  86. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  87.      lseek(2), fopen(3S), fsetpos(3S), popen(3S), stdio(3S), ungetc(3S).
  88.  
  89. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  90.      _f_s_e_e_k returns non-zero for improper seeks, otherwise zero.  An improper
  91.      seek can be, for example, an _f_s_e_e_k done on a file that has not been
  92.      opened via _f_o_p_e_n; in particular, _f_s_e_e_k may not be used on a terminal, or
  93.      on a file opened via _p_o_p_e_n(3S).
  94.  
  95. WWWWAAAARRRRNNNNIIIINNNNGGGG
  96.      The ANSI C Standard restricts the use of _o_f_f_s_e_ts, when _s_t_r_e_a_m refers to a
  97.      text file.  When operating on these files, the value of _o_f_f_s_e_t must be
  98.      zero unless _w_h_e_n_c_e is SSSSEEEEEEEEKKKK____SSSSEEEETTTT.  This restriction is necessary as the
  99.      unit of _o_f_f_s_e_ts may not be bytes on some systems, and arithmetic may not
  100.      meaningfully be performed on them.
  101.      As the unit of _o_f_f_s_e_t on this system (and on most UNIX systems) is bytes
  102.      for text as well as for binary files, the restrictions indicated in the
  103.      ANSI C Standard are not enforced.  Portable programs, however, should be
  104.      coded accordingly.
  105.  
  106.      Users of the -_n_3_2 compilation model are directed to either use _f_t_e_l_l_6_4
  107.      and _f_s_e_e_k_6_4 or _f_g_e_t_p_o_s and _f_s_e_t_p_o_s in place of _f_t_e_l_l and _f_s_e_e_k. The
  108.      reason for this is because the _o_f_f_s_e_t argument to _f_s_e_e_k, and the return
  109.      value from _f_t_e_l_l are both typed as _l_o_n_g, which is not sufficient to
  110.      express the maximum file length supported by the -_n_3_2 compilation model.
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.